import request from '@/utils/request'
// 农场查询
export const getBaseInfoPageApi = (baseId) => request.get(`/base_info/page?baseId=${baseId}`)

// 农场查询
export const getBaseInfoIdApi = (baseId) => request.get(`/base_info/getById?baseId=${baseId}`)

// 农场编辑
export const editBaseInfoPageApi = (params) => request.patch('/base_info/updateById', params)

// 农场新增
export const addBaseInfoPageApi = (data) => request.post('/base_info/add', data)

// 农场列表查询
export function getBaseInfolistApi (params) {
  return request({
    url: '/base_info/list',
    method: 'get',
    params
  })
}

// 计划提交
export function addAgriplantApi (data) {
  return request({
    url: '/agriplan/add',
    method: 'post',
    data
  })
}

// 农场计划列表查询
export function getAgriplanListApi (params) {
  return request({
    url: '/agriplan/list',
    method: 'get',
    params
  })
}

// 农场计划列表分页查询
export function getAgriplanPageApi (params) {
  return request({
    url: '/agriplan/page',
    method: 'get',
    params
  })
}

// 地块列表
export function getLandinfoListApi (params) {
  return request({
    url: '/land_info/list',
    method: 'get',
    params
  })
}

// 获取计划详情
export function getDetailById (params) {
  return request({
    url: `/agriplan/getDetailById/${params.id}`,
    method: 'get',
    params
  })
}

// 农事计划删除
export function deleteAgriplan (params) {
  return request({
    url: '/agriplan/removeByIds',
    method: 'delete',
    params
  })
}
// 农事计划更新
export function updateAgriplan (data) {
  return request({
    url: '/agriplan/updateById',
    method: 'patch',
    data
  })
}

// 溯源码列表
export function getTracingListApi (params) {
  return request({
    url: '/tracing_source/page',
    method: 'get',
    params
  })
}

// 溯源码详情
export function getTracingDetailApi (params) {
  return request({
    url: `/tracing_source/getDetailById/${params.id}`,
    method: 'get',
    params
  })
}

// 溯源码添加
export function addTracing (data) {
  return request({
    url: '/tracing_source/add',
    method: 'post',
    data
  })
}

// 溯源码生成
export function getTracingSource (params) {
  return request({
    url: '/tracing_source/getTracingSource',
    method: 'get',
    params
  })
}

// 删除溯源码
export function deleteTracing (params) {
  return request({
    url: '/tracing_source/removeByIds',
    method: 'delete',
    params
  })
}

// 农事计划更新
export function updateTracing (data) {
  return request({
    url: '/tracing_source/updateById',
    method: 'patch',
    data
  })
}
